/**
 * @file    mcu_type.h
 * @brief   MCU类型定义
 * @author  Liuwei
 * @version 1.0.1
 * @date 2023-04-22
 * 
 * @copyright Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version   <th>Author   <th>Description
 * <tr><td>2023-04-22 <td>1.0.1     <td>Liuwei     <td>首次创建
 * </table>
 */
#ifndef __MCU_TYPE_H_
#define __MCU_TYPE_H_

/* File Includes -------------------------------------------------------------*/
#include "m480.h"
/* Cplusplus -----------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif

/* Macro/Define/Typedef ------------------------------------------------------*/
#define MCU_MODE_LITTLE         (0)   /* 小端模式*/
// #define MCU_MODE_BIG            (1)   /* 大端模式*/

/**
 * @brief 共用体半字
 */
typedef union
{
	uint16_t half;
	struct 
	{
#ifdef MCU_MODE_BIG
		uint8_t h_byte;
		uint8_t l_byte;
#else 
		uint8_t l_byte;
		uint8_t h_byte;
#endif
	}byte;
}un_half_type;

// 交换高低字节
#define SW_U16_BYTE(data)   ((data & 0x00ff) << 8) + ((data & 0xff00) >> 8)
#define LIT_TO_BIG(data)    ((data & 0x00ff) << 8) + ((data & 0xff00) >> 8)

/* @brief */

/* Variables -----------------------------------------------------------------*/

/*******************************************************************************
 * public API List
 ******************************************************************************/

#ifdef __cplusplus
}
#endif

#endif  /* #ifndef __MCU_TYPE_H_ */
/*****************************(C)Copyright end *******************************/



